

import java.net.*;
import java.lang.*;
import java.io.*;

class UdpRecive{

	public static void main(String[] args) throws Exception
	{
		DatagramSocket s = new DatagramSocket(8888);
		SocketRecive send = new SocketRecive(s);
		send.reciveData();
	}

}

class SocketRecive{

	private DatagramSocket s;

	SocketRecive(DatagramSocket s){
		this.s = s;
	}


	public void reciveData() throws Exception
	{
		while(true){
		byte[] data = new byte[1024];
		DatagramPacket dp = new DatagramPacket(data,data.length);
		this.s.receive(dp);

		String ip = dp.getAddress().getHostAddress();
		String dataStr = new String(dp.getData(),0,dp.getLength());

		int port = dp.getPort();

		System.out.println(ip+"--------"+dataStr+"------"+port);

		}
	}

}
